# import pytest
# import yaml
# from selenium import webdriver
#
# import time
#
# from selenium.webdriver.common.by import By
#
#
# def test_yaml_login():
# #     with open('yaml.yaml','r',encoding='utf-8') as file:
# #         return yaml.safe_load(file)
# # @pytest.mark.parametrize('test_case',test_yaml_login())
#     with open('yaml.yaml','-r',encoding='utf-8') as file:
#         return yaml.safe_load(file)
# @pytest.mark.parametrize('test_case',test_yaml_login())
# def test_01(test_case):
#     driver=webdriver.Edge()
#     driver.maximize_window()
#     driver.get('http://10.59.9.14:7003/')
#     driver.find_element(By.LINK_TEXT,'登录').click()
#     time.sleep(2)
#     driver.find_element(By.NAME,'username').send_keys(test_case['username'])
#     driver.find_element(By.NAME,'password').send_keys(test_case['password'])
#     time.sleep(10)
#     driver.find_element(By.CLASS_NAME,'finish-btn').click()
#     time.sleep(5)
#
#     dy=driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').text
#     print('登录成功后的断言',dy)
#     # assert dy==test_case['b']
#     assert dy==test_case['b']
#
#     driver.quit()
import pytest
import yaml
from selenium import webdriver
import time

from selenium.webdriver.common.by import By


def test_yaml_login():
    with open('yaml.yaml','r',encoding='utf-8') as file:
        return yaml.safe_load(file)
@pytest.mark.parametrize('test_case',test_yaml_login())
def test_01(test_case):
    driver=webdriver.Edge()
    driver.maximize_window()
    driver.get('http://10.59.9.14:7003/')
    driver.find_element(By.LINK_TEXT,'登录').click()
    time.sleep(2)
    driver.find_element(By.NAME,'username').send_keys(test_case['username'])
    driver.find_element(By.NAME,'password').send_keys(test_case['password'])
    time.sleep(10)
    driver.find_element(By.CLASS_NAME, 'finish-btn').click()
    time.sleep(5)

    dy=driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').text
    print("断言1",dy)
    assert dy==test_case['b']
    driver.quit()